package com.sxf.core.db.datasource;


import com.sxf.core.db.common.DynamicDataSourceGlobal;

/**
 * 
 * @description: 动态数据源副本
 * @author: zhangyb@ccccit.com.cn
 * @date: 2021年1月7日 下午4:48:51
 */
public final class DynamicDataSourceHolder {

    private static final ThreadLocal<DynamicDataSourceGlobal> HOLDER = new ThreadLocal<DynamicDataSourceGlobal>();

    private DynamicDataSourceHolder() {}

    public static void putDataSource(DynamicDataSourceGlobal dataSource) {
        HOLDER.set(dataSource);
    }

    public static DynamicDataSourceGlobal getDataSource() {
        return HOLDER.get();
    }

    public static void clearDataSource() {
        HOLDER.remove();
    }
}
